let { invoker } = require('./invoker');
let { Context } = require('./context');
let { Iterator } = require('./iterator');
/** 将用户代码转为生成器 */
function generator(userFunc) {
    return function() {
        let context =  new Context();
        let generatorInvoker = invoker(userFunc, context);
        return Iterator(generatorInvoker, context);
    }
}

exports.generator = generator;